<template>
	<view style="width: 100%;">
		<view class="item" @click="showBirthday=!showBirthday" >
			<u--input inputAlign="right" v-model="value" disabled disabledColor="transparent" :placeholder="placeholder" border="none"></u--input>
			<u-icon name="arrow-right"></u-icon>
		</view>
		
		<u-datetime-picker  :show="showBirthday" :value="value" mode="date" closeOnClickOverlay
			@confirm="confirm" @cancel="close" @close="close"></u-datetime-picker>
	</view>
</template>

<script>
	export default {
		name: 'smma-date',
		props: {
			placeholder: {
				type: String,
				default: '请选择'
			},
			value:{
				type:String,
				default:''
			}
		},
		data(){
			return {
				showBirthday:false,
			}
		},
		methods:{
			close() {
				this.showBirthday = false
			},
			confirm(e) {
				this.showBirthday = false
				this.value = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
				this.$emit("input",this.value)
			},
		}
	}
</script>

<style scoped lang="scss">
	.item {
		display: flex;
		.u-input {
			pointer-events:none;
		}
	}
</style>